package main.java.JDBC;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class jdbc01 {
    private static String Driver = "org.apache.hive.jdbc.HiveDriver";
    private static String url = "jdbc:hive2://192.168.72.129:10000/default?useUnicode=true&characterEncoding=UTF-8";
    private static String name = "root";
    private static String password = "tanchao0123";
    public static void main(String[] args) {
        try {
            Class.forName(Driver);
            Connection conn = DriverManager.getConnection(url,name,password);
            Statement stat =conn.createStatement();
            String sql  ="show databases";
            ResultSet rs = stat.executeQuery(sql);
            while (rs.next()) {
                System.out.println(rs.getString(1));
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


}
